import Vue from 'vue'
import { constant } from '@/constant'
/**
 *  奖品管理 ********奖品类型（显示）
 */
Vue.component('questionnaire', {
    template: [
        `<div>`,
        `<el-tag size="mini" type="danger" v-if="rowData.awardType == 1">现金</el-tag>`,
        `<el-tag size="mini" type="success" v-if="rowData.awardType == 0">金豆</el-tag>`,
        `</div>`,
    ].join(''),
    props: {
        rowIndex: {
            type: Number,
            required: true
        },
        rowData: {
            type: Object,
            required: true
        },
        columnData: {
            type: Object,
            required: true
        },
    },
    components: {},
    data() {
        return {}
    },
    created() {},
    methods: {
        // showDetailDialog() {
        //     let vm = this;
        //     console.log(vm.rowData.businessCode)
        //     if (vm.rowData.businessCode == 'jx_course_assessment_scheme') {   // 课程考核方案
        //         // 打开详情dialog
        //         let data = {
        //             courseAssessmentScheme: {
        //                 id : vm.rowData.businessId
        //             }
        //         }
        //         vm.$store.commit(`COURSE_ASSESSMENT_SCHEME_DETAIL`, {"dialogState": true, "data": data });
        //     }
        //     if (vm.rowData.businessCode == 'jx_teach_support_base') {  // 教学支持计划
        //         //  主键id
        //         let id = vm.rowData.businessId;
        //         vm.$store.commit(`TEACH_SUPPORT_DETAIL`, {"dialogState": true, "data": id});
        //     }
        //     if (vm.rowData.businessCode == 'jz_career_development_base') {  // 职业发展服务支持计划
        //         //  主键id
        //         let id = vm.rowData.businessId;
        //         vm.$store.commit(`CAREER_PLAN_DETAIL`, {"dialogState": true, "data": id});
        //     }
        // },
    }
})

/**
 *  订单管理 ********修改订单状态
 */
Vue.component('statusName', {
    template: [
        `<div>`,
        `<el-select v-model="rowData.statusId" placeholder="请选择" size="mini">`,
        `<el-option`,
        `v-for="item in options.orderStatusOptions"`,
        `:key="item.id"`,
        `:label="item.dictValue"`,
        `:value="item.id">`,
        `</el-option>`,
        ` </el-select>`,
        `</div>`,
    ].join(''),
    props: {
        rowIndex: {
            type: Number,
            required: true
        },
        rowData: {
            type: Object,
            required: true
        },
        columnData: {
            type: Object,
            required: true
        },
    },
    components: {},
    data() {
        return {
            options: {
                orderStatusOptions: []
            }
        }
    },
    created() {
        this.getOrderStatus();
    },
    methods: {
        // 获取订单状态
        getOrderStatus() {
            let vm = this;
            vm.axios.get(api.dictionary.dictList + "?page=1&type=ORDER_STATUS").then((response) => {
                if (response.data.code == 200) {
                    vm.options.orderStatusOptions = response.data.data.dataList;
                } else {
                    Message({
                        message: response.data.msg,
                        type: 'error'
                    });
                }
            })
        },
    }
})